from spaghetti import SpaghettiVM

def do_log(x):
    print x

def do_assert_fail(x,i):
    print "Line %s failed assert: %s"%(i,x)


vm = SpaghettiVM()
vm.log = do_log
vm.assert_failed = do_assert_fail

def do_something(x):
    print "doing something with "+str(x)

vm.attach_interrupt(20,do_something,["A"])

code = '''
ADDE 1
ADDE 2
ADDE 3
GETE A,2
INT 20
'''

vm.execute(code)
